diff --git a/system/libraries/Table.php b/system/libraries/Table.php
new file mode 100644
index 0000000..935a7d8
--- /dev/null
+++ b/system/libraries/Table.php
@@ -0,0 +1,325 @@
+<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * Code Igniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package		CodeIgniter
+ * @author		Rick Ellis
+ * @copyright	Copyright (c) 2006, pMachine, Inc.
+ * @license		http://www.codeignitor.com/user_guide/license.html 
+ * @link		http://www.codeigniter.com
+ * @since		Version 1.3.1
+ * @filesource
+ */
+ 
+// ------------------------------------------------------------------------
+
+/**
+ * HTML Table Generating Class
+ * 
+ * Lets you create tables manually or from database result objects, or arrays.
+ *
+ * @package		CodeIgniter
+ * @subpackage	Libraries
+ * @category	HTML Tables
+ * @author		Rick Ellis
+ * @link		http://www.codeigniter.com/user_guide/libraries/uri.html
+ */
+class CI_Table {
+
+	var $rows		= array();
+	var $heading	= array();
+	var $template 	= NULL;
+	var $newline	= "\n";
+	
+	
+	function CI_Table()
+	{
+		log_message('debug', "Table Class Initialized");
+	}
+
+	// --------------------------------------------------------------------
+
+	/**
+	 * Set the template
+	 *
+	 * @access	public
+	 * @param	array
+	 * @return	void
+	 */
+	function set_template($template)
+	{
+		if ( ! is_array())
+		{
+			return FALSE;
+		}
+	
+		$this->template = $template;
+	}
+
+	// --------------------------------------------------------------------
+
+	/**
+	 * Add a table heading
+	 *
+	 * Can be passed as an array or discreet params
+	 *
+	 * @access	public
+	 * @param	mixed
+	 * @return	void
+	 */
+	function add_heading()
+	{
+		$args = func_get_args();
+		$this->heading = (is_array($args[0])) ? $args[0] : $args;
+	}
+
+	// --------------------------------------------------------------------
+
+	/**
+	 * Add a table row
+	 *
+	 * Can be passed as an array or discreet params
+	 *
+	 * @access	public
+	 * @param	mixed
+	 * @return	void
+	 */
+	function add_row()
+	{
+		$args = func_get_args();
+		$this->rows[] = (is_array($args[0])) ? $args[0] : $args;
+	}
+	
+	// --------------------------------------------------------------------
+
+	/**
+	 * Generate the table
+	 *
+	 * @access	public
+	 * @param	mixed
+	 * @return	string
+	 */
+	function generate($table_data = NULL)
+	{
+		// The table data can optionally be passed to this function
+		// either as a database result object or an array
+		if ( ! is_null($table_data))
+		{
+			if (is_object($table_data))
+			{
+				$this->_set_from_object($table_data);
+			}
+			elseif (is_array($table_data))
+			{
+				$this->_set_from_array($table_data);
+			}
+		}
+	
+		// Is there anything to display?  No?  Smite them!
+		if (count($this->heading) == 0 AND count($this->rows) == 0)
+		{
+			return 'Undefined table data';
+		}
+	
+		// Compile and validate the templata date
+		$this->_compile_template();
+	
+	
+		// Build the table!
+		
+		$out = $this->template['table_open'];
+		$out .= $this->newline;		
+
+		// Is there a table heading to display?
+		if (count($this->heading) > 0)
+		{
+			$out .= $this->template['heading_row_start'];
+			$out .= $this->newline;		
+
+			foreach($this->heading as $heading)
+			{
+				$out .= $this->template['heading_cell_start'];
+				$out .= $heading;
+				$out .= $this->template['heading_cell_end'];
+			}
+
+			$out .= $this->template['heading_row_end'];
+			$out .= $this->newline;				
+		}
+
+		// Build the table rows
+		if (count($this->rows) > 0)
+		{
+			$i = 1;
+			foreach($this->rows as $row)
+			{
+				if ( ! is_array($row))
+				{
+					break;
+				}
+			
+				// We use modulus to alternate the row colors
+				$alt = (fmod($i++, 2)) ? '' : 'alt_';
+			
+				$out .= $this->template['row_'.$alt.'start'];
+				$out .= $this->newline;		
+	
+				foreach($row as $cells)
+				{
+					$out .= $this->template['cell_'.$alt.'start'];
+					$out .= $cells;
+					$out .= $this->template['cell_'.$alt.'end'];
+				}
+	
+				$out .= $this->template['row_'.$alt.'end'];
+				$out .= $this->newline;	
+			}
+		}
+
+		$out .= $this->template['table_close'];
+	
+		return $out;
+	}
+
+	// --------------------------------------------------------------------
+
+	/**
+	 * Set table data from a database result object
+	 *
+	 * @access	public
+	 * @param	object
+	 * @return	void
+	 */
+	function _set_from_object($query)
+	{
+		if ( ! is_object($query))
+		{
+			return FALSE;
+		}
+		
+		// First generate the headings from the table column names
+		if (count($this->heading) == 0)
+		{
+			if ( ! method_exists($query, 'field_names'))
+			{
+				return FALSE;
+			}
+			
+			$this->heading = $query->field_names();
+		}
+				
+		// Next blast through the result array and build out the rows
+		foreach ($query->result_array() as $row)
+		{
+			$this->rows[] = $row;
+		}
+	}
+
+	// --------------------------------------------------------------------
+
+	/**
+	 * Set table data from an array
+	 *
+	 * @access	public
+	 * @param	array
+	 * @return	void
+	 */
+	function _set_from_array($data)
+	{
+		if ( ! is_array($data) OR count($data) == 0)
+		{
+			return FALSE;
+		}
+		
+		$i = 0;
+		foreach ($data as $row)
+		{
+			if ( ! is_array($row))
+			{
+				$this->rows[] = $data;
+				break;
+			}
+						
+			// If a heading hasn't already been set we'll use the first row of the array as the heading
+			if ($i == 0 AND count($data) > 1 AND count($this->heading) == 0)
+			{
+				$this->heading = $row;
+			}
+			else
+			{
+				$this->rows[] = $row;
+			}
+			
+			$i++;
+		}
+	}
+
+	// --------------------------------------------------------------------
+
+	/**
+	 * Compile Template
+	 *
+	 * @access	private
+	 * @return	void
+	 */
+ 	function _compile_template()
+ 	{ 	
+ 		if ($this->template == NULL)
+ 		{
+ 			$this->template = $this->_default_template();
+ 			return;
+ 		}
+		
+		$this->temp = $this->_default_template();
+		foreach (array('table_open','heading_row_start', 'heading_row_end', 'heading_cell_start', 'heading_cell_end', 'row_start', 'row_end', 'cell_start', 'cell_end', 'row_alt_start', 'row_alt_end', 'cell_alt_start', 'cell_alt_end', 'table_close') as $val)
+		{
+			if ( ! isset($this->template[$val]))
+			{
+				$this->template[$val] = $this->temp[$val];
+			}
+		} 	
+ 	}
+	
+	// --------------------------------------------------------------------
+
+	/**
+	 * Default Template
+	 *
+	 * @access	private
+	 * @return	void
+	 */
+	function _default_template()
+	{
+		return  array (
+						'table_open' 			=> '<table border="0" cellpadding="4" cellspacing="0">',
+
+						'heading_row_start' 	=> '<tr>',
+						'heading_row_end' 		=> '</tr>',
+						'heading_cell_start'	=> '<th>',
+						'heading_cell_end'		=> '</th>',
+
+						'row_start' 			=> '<tr>',
+						'row_end' 				=> '</tr>',
+						'cell_start'			=> '<td>',
+						'cell_end'				=> '</td>',
+
+						'row_alt_start' 		=> '<tr>',
+						'row_alt_end' 			=> '</tr>',
+						'cell_alt_start'		=> '<td>',
+						'cell_alt_end'			=> '</td>',
+
+						'table_close' 			=> '</table>'
+					);	
+	}
+
+
+
+ 	
+ 	
+ 	
+
+}
+
+?>
\ No newline at end of file
